﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLTV_Public;

namespace QLTV_Data
{
   public class NguonCungCap_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_NguonCungCap");
       }
       public int Insert(NguonCungCap_Public maNguonCung, NguonCungCap_Public tenNguonCung, NguonCungCap_Public ghiChu)
       {
           int Npara = 3;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0]="@MaNguonCung";
           value[0] = maNguonCung.MaNguonCung;
           name[1] = "@TenNguonCung";
           value[1] = tenNguonCung.TenNguonCung;
           name[2] = "@GhiChu";
           value[2] = ghiChu.GhiChu;
           return kn.update("Insert_NguonCungCap",name,value,Npara);
       }
       public int Update(NguonCungCap_Public maNguonCung, NguonCungCap_Public tenNguonCung, NguonCungCap_Public ghiChu)
       {
           int Npara = 3;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0] = "@MaNguonCung";
           value[0] = maNguonCung.MaNguonCung;
           name[1] = "@TenNguonCung";
           value[1] = tenNguonCung.TenNguonCung;
           name[2] = "@GhiChu";
           value[2] = ghiChu.GhiChu;
           return kn.update("Update_NguonCungCap", name, value, Npara);
       }
       public int Delete(NguonCungCap_Public maNguonCung)
       {
           int Npara = 1;
           string[] name = new string[Npara];
           object[] value = new object[Npara];
           name[0] = "@MaNguonCung";
           value[0] = maNguonCung.MaNguonCung;

           return kn.update("Delete_NguonCungCap", name, value, Npara);
       }
    }
}
